<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <div id="app">
        商品数量：<input type="text" v-model="num">
        商品价格：<input type="text" v-model="price">
        <span>商品总价：{{total}}</span>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        // 创建 Vue 实例，得到 ViewModel
        var vm = new Vue({
            el: '#app',
            data: {
                num: 1,
                price: 20,
            },
            methods: {},
            computed: {
                total() {
                    return this.num*this.price;
                }
            }
        });
    </script>
</body>

</html>